package ua.eug.airv1.orders;

import ua.eug.airv1.controllers.ScreenController;
import ua.eug.airv1.map.IOnScreen;

import com.badlogic.gdx.scenes.scene2d.Group;

public class OrderHolder extends Group implements IOnScreen {
	
	//private Array<WeaponOrder> orders = new Array<WeaponOrder>(false,64);
	private WeaponOrder active = WeaponOrder.ZOrder;

	protected OrderHolder() {		
		ScreenController.getInstance().addSlave(this);
	}
	
	private static class SingletonHolder {
        public static final OrderHolder HOLDER = new OrderHolder();
    }
	
	public static OrderHolder getInstance() {
        return SingletonHolder.HOLDER;
    }

	public void addOrder(WeaponOrder o) {
		this.addActor(o);
	}
	public void setActive(WeaponOrder o) {
		active.resetActive(); // only one active order
		active = o;
	}
	
	@Override
	public void pan(float x, float y) {
		this.setPosition(x, y);
	}

	@Override
	public void zoom(float z) {
		this.setScale(z);
	}
	
}
